package com.lineage.server.command.executor;

import com.lineage.server.datatables.lock.CharBuffReading;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_PacketBoxGm;
import com.lineage.server.serverpackets.S_ServerMessage;
import com.lineage.server.serverpackets.ServerBasePacket;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class L1BuffKick implements L1CommandExecutor {
  private static final Log _log = LogFactory.getLog(L1BuffKick.class);
  
  public static L1CommandExecutor getInstance() {
    return new L1BuffKick();
  }
  
  public void execute(L1PcInstance pc, String cmdName, String arg) throws Exception {
    try {
      int objid = Integer.parseInt(arg);
      CharBuffReading.get().deleteBuff(objid);
      if (pc == null) {
        _log.warn("系统命令执行: 指定角色objid Buff清除!");
        return;
      } 
      pc.sendPackets((ServerBasePacket)new S_ServerMessage(166, String.valueOf(String.valueOf(objid)) + " Buff清除!"));
      return;
    } catch (Exception e) {
      int mode = 0;
      if (pc != null) {
        pc.sendPackets((ServerBasePacket)new S_PacketBoxGm(pc, 0));
        return;
      } 
      return;
    } 
  }
}
